package com.SinaMicroblogging.Extension;

import java.util.List;

import com.SinaMicroblogging.R;
import com.SinaMicroblogging.Extension.StatusModelAdapter.ViewHolder;
import com.SinaMicrobloggingApi.Model.StatusModel;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ActionTextAdapter extends BaseAdapter {

	private String[] text;
	private LayoutInflater layoutInflater;

	public ActionTextAdapter(String[] text, Context context) {
		this.text = text;
		layoutInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return text == null ? 0 : text.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return text[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder viewHolder;
		if (convertView == null) {
			convertView = layoutInflater.inflate(R.layout.actiontextitemview,
					null);
			viewHolder = new ViewHolder();
			viewHolder.actionText = (TextView) convertView
					.findViewById(R.id.actiontext);
			convertView.setTag(viewHolder);

		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		viewHolder.actionText.setText(text[position]);
		return convertView;
	}

	static class ViewHolder {
		TextView actionText;
	}
}
